<template>
  <div class="user-address">
    <div class="left">
      <user-address-info/>
    </div>
    <div class="right">
      <xtx-button @click="showChangeAddr = !showChangeAddr">切换地址</xtx-button>
      <xtx-button @click="showAddrForm = !showAddrForm">添加地址</xtx-button>
    </div>
  </div>
</template>

<script lang="ts"
        setup>
import XtxButton from '@/components/library/XtxButton.vue'
import UserAddressInfo from '@/views/cart/pay/components/UserAddressInfo.vue'
import type {Ref} from 'vue'
import {inject, ref} from 'vue'

let showChangeAddr = inject<Ref<boolean>>('showChangeAddr') ?? ref<boolean>(false)
let showAddrForm = inject<Ref<boolean>>('showAddrForm') ?? ref<boolean>(false)
</script>

<style lang="less"
       scoped>
.user-address {
  border: 1px solid #f5f5f5;
  display: flex;
  align-items: center;

  .left {
    flex: 1;
  }

  .right {
    width: 420px;
    display: flex;
    align-items: center;
    justify-content: center;

    * ~ * {
      margin-left: 10px;
    }
  }
}
</style>